import React, { Component, lazy, Suspense } from 'react';
import './App.css'
import { Route, Switch, Redirect } from 'react-router-dom';
import RouterView from './router/RouterView';
import routes from './router/routeConfig'

// let Index = lazy(() => import('./view/Index/Index'))
// let Login = lazy(() => import('./view/Login'))
// let Register = lazy(() => import('./view/Register/Register'))
// let Detail = lazy(() => import('./view/Detail'))
// let Search = lazy(() => import('./view/Search'))
// let Success = lazy(() => import('./view/Order/Success'))
// let SearchList = lazy(() => import('./view/SearchList'))
// let City = lazy(() => import('./view/City'))
// let NotFound = lazy(() => import('./view/NotFound'))
// let Code = lazy(() => import('./view/Register/Code'))
// let Password = lazy(() => import('./view/Register/Password'))
// let Address = lazy(() => import('./view/address/Address'))
// let Modify = lazy(() => import('./view/address/Modify'))
// let Order = lazy(() => import('./view/Order/Order'))
// let Orders = lazy(() => import('./view/Order/Orders'))
// let Set = lazy(() => import('./view/Set'))


class App extends Component {

  render() {
    return (
      <div className='app'>

        {/* 渲染RouterView组件 (内部会动态生成路由规则) */}
        <RouterView routes={routes} />

        {/* <Suspense>
          <Switch>
            <Route path='/index' component={Index} />
            <Route exact path='/login' component={Login} />

            <Route exact path='/register' component={Register} />

            <Route exact path='/detail' component={Detail} />
            <Route exact path='/search' component={Search} />
            <Route exact path='/success' component={Success} />
            <Route exact path='/searchlist' component={SearchList} />
            <Route exact path='/city' component={City} />
            <Route exact path='/code' component={Code} />

            <Route exact path='/password' component={Password} />
            <Route exact path='/address' component={Address} />
            <Route exact path='/modify' component={Modify} />
            
            <Route exact path='/set' component={Set} />
            <Route exact path='/order' component={Order} />
            <Route exact path='/orders' component={Orders} />
            <Redirect exact from='/' to='/index' />
            <Route path='*' component={NotFound} />
          </Switch>
        </Suspense> */}
      </div>
    );
  }
}

export default App;